﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace Motion
{
    /// <summary>
    /// App.xaml 的交互逻辑
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            if (e.Args.Length <= 0)
            {
                string AppName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;
                if (System.Diagnostics.Process.GetProcessesByName(AppName).Length > 1)
                {
                    //已经有程序被打开了。
                    MessageBox.Show("程序已经在运行，请关闭已有实例！");
                    base.Shutdown();
                    return;
                }
            }
        }
    }
}
